Text sound and images
ASCII code and Unicode
ASCII code
- Text is converted to binary to be processed by a computer according to ASCII code.(8 bits per character)
DEC | OCT | HEX | BIN | Symbol | HTML Number | Description |
---|---|---|---|---|---|---|
65 | 101 | 41 | 01000001 | A | A | Uppercase A |
66 | 102 | 42 | 01000010 | B | B | Uppercase B |
67 | 103 | 43 | 01000011 | C | C | Uppercase C |
68 | 104 | 44 | 01000100 | D | D | Uppercase D |
69 | 105 | 45 | 01000101 | E | E | Uppercase E |
70 | 106 | 46 | 01000110 | F | F | Uppercase F |
Unicode
Unicode allows for a greater range of characters and symbols than ASCII, including different languages and emojis. (16 bits per character)
Sound
- A sound wave is sampled for sound to be converted to binary.
- The sample rate is the number of samples taken in a second.
- The sample resolution is the number of bits per sample.
Sample rate
- standard sampling rate is 44 100 samples per second.
Sample resolution
- In audio CDs, each sample is recorded as a 16-bit integer.
Calculating audio file sizes
The file size = sampling rate x sampling resolution x seconds.
A 32-second sound clip will be recorded.
The sound will be sampled 16000 times a seconds.
Each sample will be stored using 8 bits.
16000 x 8 x 32 = 4096000 bits
Images
- A pixel is a smallest element in a image, its color is represented by three component intensities such as red, green, and blue. (RGB)
- The image resolution is the product of the width multiply with the height of the image.
Colour depth
- Colour depth is the number of bits used to indicate the color of a pixel.
- Normally, we use 24 bits to represent the color of a pixel.
- For example
- #FF 00 00 represents primary colour red
- #00 FF 00 represents primary colour green
- #00 00 FF represents primary colour blue
- #FF 00 FF represents fuchsia
Calculating bit-map image file sizes
- The file size = image resolution x colour depth.
- The image has a resolution of 400 x 300 pixels, and a colour depth of 8 bits per pixel.
400 x 300 x 8 = 960000 bits